/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package metier;

import utiles.K;
import utiles.TypeFrequence;

/**
 *
 * @author Guillaume S. <guillaume@sainthillier.fr>
 */
public class Environnement {
    
    protected int duree_vie_fourmis, quantite_naissance;
	protected double frequence_naissance;
    private int concentration;
    private int evaporation;
    protected TypeFrequence type_frequence_naissance;
	private int frequence_naissance_int;
    
    public Environnement()
    {
        this(2,3,TypeFrequence.Seconde,2,2,2);
    }
    
    public Environnement(int duree_vie_fourmis, int frequence_naissance, TypeFrequence type_frequence_naissance, int quantite_naissance, int concentration_pheromone, int vitesse_evaporation_pheromone)
    {
        this.setDureeVieFourmis(duree_vie_fourmis);
        this.setTypeFrequenceNaissance(type_frequence_naissance);
        this.setFrequenceNaissance(frequence_naissance);
        this.setQuantiteNaissance(quantite_naissance);
        this.setConcentration(concentration_pheromone);
        this.setEvaporation(vitesse_evaporation_pheromone);
    }

	public int getFrequenceNaissanceInt() {
		return frequence_naissance_int;
	}
    
    public int getDureeVieFourmis() {
        return duree_vie_fourmis;
    }

    public void setDureeVieFourmis(int duree_vie_fourmis) {
        this.duree_vie_fourmis = duree_vie_fourmis * K.COEFF_DUREE_VIE_FOURMIS;
    }

    public double getFrequenceNaissance() {
        return frequence_naissance;
    }

    public void setFrequenceNaissance(int frequence_naissance) {
		this.frequence_naissance_int = frequence_naissance;
        this.frequence_naissance = frequence_naissance * K.COEFF_FREQUENCES_NOUVELLES_NAISSANCES_FOURMIS;
        
        int numerateur_coef;
        int denominateur_coef = K.TIME_TICK;
        
        switch(this.type_frequence_naissance)
        {
            case Seconde:
                numerateur_coef = 1000; // 1000ms
            break;
            case Minute:
                numerateur_coef = 60*1000; // 60 000ms
            break;
            case Heure: 
                numerateur_coef = 60*60*1000; //etc
            break;
            default: //Cycle
                numerateur_coef = K.TIME_TICK;
            break;
        }
        
        this.frequence_naissance /= (numerateur_coef / denominateur_coef);
    }

    public TypeFrequence getTypeFrequenceNaissance() {
        return type_frequence_naissance;
    }

    public void setTypeFrequenceNaissance(TypeFrequence type_frequence_naissance) {
        this.type_frequence_naissance = type_frequence_naissance;
    }

    public int getQuantiteNaissance() {
        return quantite_naissance;
    }

    public void setQuantiteNaissance(int quantite_naissance) {
        this.quantite_naissance = quantite_naissance * K.COEFF_QUANTITES_NAISSANCE_FOURMIS;
    }

    public int getConcentration() {
		return concentration;
	}

	public void setConcentration(int concentration) {
		this.concentration = concentration;
	}

	public int getEvaporation() {
		return evaporation;
	}

	public void setEvaporation(int evaporation) {
		this.evaporation = evaporation;
	}
}
